<template>
    <div class="app-container">
        <div class="maindiv">
            <!-- {{ e }} -->
            <div class="ces-main">
                <!-- style=" width: 350px;position: absolute;top: -2px;right: -20px;" -->
                <!-- style="position: absolute;top: 5px;right: 2px;top:8px" -->
                <Search-Form ref="form" size="mini" labelWidth="50px" :searchData="SearchGroup" :tableCols="tableCols"
                    :searchHandle="searchHandle" @handleEnter="refresh"></Search-Form>
                <v-GetToolBar style="position: absolute;right: 2px;top:11px" align="right" :key="MenuCode"
                    :MenuCode="MenuCode" :IsfunEdit="IsfunEdit" :Isfunfail="Isfunfail" @handeAdd="handeAdd"
                    @handleEdit="handleEdit" @OpenFindForm="searchTop" @handlexportData="handlexportData"
                    @IsfunEdit="handleIsfunEdit" @IsfunDelete="handleIsfunfail"
                    @handleclose="handleclose"></v-GetToolBar>

                <ces-table :ToolBarheight="ToolBarheight" size="mini" :isSelection="false" :isIndex="true"
                    :isSearch="true" :isHandle="false" :IsfunEdit="true" :Isfunfail="true" :tableData="tableData"
                    :tableCols="tableCols" :Search="SearchGroup" @refresh="refresh" @handleEdit="handleEdit"
                    @handleDelete="delData" @handrowclick="handrowclickTop" @select="selectMata"
                    @selectAll="selectMata">
                </ces-table>
            </div>

            <div class="midMain">
                <div>
                    <Search-Form ref="form" size="mini" labelWidth="50px" :searchData="SearchGroupInfo"
                        :tableCols="tableColsInfo" :searchHandle="searchHandle" @handleEnter="refresh"></Search-Form>
                </div>

                <div class="botonRight">
                    <el-button type="primary" icon="el-icon-search" size="mini" @click="searchDown">查询</el-button>
                    <el-button v-if="activeName === 'second'" type="success" icon="el-icon-sort" size="mini"
                        @click="configure">关联</el-button>
                </div>

                <el-tabs v-model="activeName" @tab-click="handleClick">
                    <el-tab-pane label="配置工序" name="first">
                        <div style="display: flex;">
                            <ces-table style="width: 45vw;flex:1;margin-right: 4px;" :flag="false"
                                :ToolBarheight="ToolBarheight2" size="mini" :isSelection="false" :isIndex="true"
                                :isSearch="true" :isHandle="false" :IsfunEdit="true" :Isfunfail="true"
                                :tableData="tableDataTechnique" :tableCols="tableColsTechnique"
                                :Search="SearchTechnique" :key="key" @refresh="refresh" @handleEdit="handleEditInfo"
                                @handleDelete="delDataInfo" @handrowclick="handrowclickTechnique">
                            </ces-table>
                            <i class="el-icon-arrow-left black" @click="toTop"></i>
                            <ces-table style="width: 40vw;flex:1;margin-left: 4px;" :flag="false"
                                :ToolBarheight="ToolBarheight2" size="mini" :isSelection="true" :isIndex="true"
                                :isSearch="true" :isHandle="false" :IsfunEdit="false" :Isfunfail="false"
                                :tableData="tableData15" :tableCols="tableCols15" :Search="Search15" :key="key"
                                @refresh="refresh" @handleEdit="handleEditInfo" @handleDelete="delDataInfo"
                                @handrowclick="handrowclickTechnique" @select="selectMath" @selectAll="selectMath">
                            </ces-table>
                        </div>

                    </el-tab-pane>
                    <el-tab-pane label="关联产品" name="second"><ces-table :flag="false" :ToolBarheight="ToolBarheight2"
                            size="mini" :isSelection="true" :isIndex="true" :isSearch="true" :isHandle="false"
                            :IsfunEdit="false" :Isfunfail="false" :tableData="tableDataProcedure"
                            :tableCols="tableColsProcedure" :Search="SearchProcedure" :key="key" @refresh="refresh"
                            @handleEdit="handleEditDown($event, 2)" @handleDelete="delDataInfo" @select="selectMi"
                            @selectAll="selectMi" @handrowclick="handrowclick">
                        </ces-table></el-tab-pane>
                    <el-tab-pane label="工序产能" name="third"><ces-table :flag="false" :ToolBarheight="ToolBarheight2"
                            size="mini" :isSelection="false" :isIndex="true" :isSearch="true" :isHandle="false"
                            :IsfunEdit="false" :Isfunfail="false" :tableData="tableDataCapacity"
                            :tableCols="tableColsCapacity" :Search="SearchCapacity" :key="key" @refresh="refresh"
                            @handleEdit="handleEditDown($event, 3)" @handleDelete="delDataInfo"
                            @handrowclick="handrowclick">
                        </ces-table></el-tab-pane>
                </el-tabs>
            </div>
        </div>

        <!--搜索弹框-->
        <el-dialog title="搜索" :visible.sync="SearchDialog" custom-class="dialogClass" class="searchDialog" center
            ref="searchDialog" :modal="false" :close-on-click-modal="true">
            <el-form :model="SearchGroup" label-width="90px" ref="searchForm">
                <Search-Form ref="form" :frame="true" size="mini" labelWidth="50px" :searchData="Search"
                    :tableCols="tableCols" :searchHandle="searchHandle" @handleEnter="refresh"></Search-Form>
            </el-form>
            <div slot="footer" :style="{ 'margin-buttom': 0 == 0 ? DialogBtnMargin : DialogBtnMargin }">
                <el-button @click="reform()">重置</el-button>
                <el-button type="primary" @click="refresh()">确 定</el-button>
            </div>
        </el-dialog>

        <el-dialog v-if="dialogVisible" :visible.sync="dialogVisible" width="800px" top="20px">
            <!-- {{this.FormData}} -->
            <el-form :model="name" label-width="80px" label-position="right">
                <el-tabs type="border-card">
                    <el-tab-pane label="">
                        <el-form :model="FormData" label-width="90px" ref="MianForm">
                            <Mian-Form ref="form" labelWidth="100px" :FormData="FormData" :tableCols="tableCols"
                                :StepSN="0" :searchHandle="searchHandle"></Mian-Form>
                        </el-form>
                    </el-tab-pane>
                    <div style="float:right ">
                        <el-button type="primary" @click="handleOpenClose()">关闭</el-button>
                        <el-button type="primary" @click="handleSave()">保存</el-button>
                    </div>
                </el-tabs>
            </el-form>
        </el-dialog>

        <el-dialog v-if="dialog2" :visible.sync="dialog2" width="800px" top="20px">
            <el-form :model="name" label-width="80px" label-position="right">
                <el-tabs type="border-card">
                    <el-tab-pane label="">
                        <el-form :model="FormDataInfo" label-width="90px" ref="MianForm">
                            <!-- {{ see }} -->
                            <Mian-Form ref="form" labelWidth="100px" :FormData="FormDataInfo" :tableCols="tableColsInfo"
                                :StepSN="0" :searchHandle="searchHandle"></Mian-Form>
                        </el-form>
                    </el-tab-pane>
                    <div style="float:right ">
                        <el-button type="primary" @click="handleOpenClose">关闭</el-button>
                        <el-button type="primary" @click="handleSaveInfo">保存</el-button>
                    </div>
                </el-tabs>
            </el-form>
        </el-dialog>
    </div>
</template>

<script>
//引入组件

import cesTable from "../Common//ComVxeTable.vue";
// import cesTable from "../Common//table.vue";
import SearchForm from "../Common//Search.vue";
import MianForm from "../Common//form.vue";

import { funDownload, funDownloadv1, GetTableColsData } from "@/api/Common";
import {
    getDataList,
    DeleteForm,
    CloseForm,
    UpdateForm,
    getfunDownload,
    MenuUpdate,
} from "@/api/CommonPage/CommonPage"; //更改
import vGetToolBar from "../Common/GetToolBar";

export default {
    name: "StandardProcess",
    data() {
        //表单查询一般分为input，下拉框，和日期，下面是下拉框时的设置下拉信息的情况，我的项目没有用到，但是留着方便看

        return {
            Id: '',
            activeName: "first",
            key: 1,
            see: [],
            input: "",
            ToolBarheight: null,
            ToolBarheight2: null,
            Id: null,
            index: null,
            StagingDataInfo: null,
            technologyID: null,
            FormDataInfo: [],
            dialog2: false,
            MenuCode: "A051115",
            tableData: [], //表格数据
            tableCols: [], //表格列数据
            FormData: [], //表格数据
            tableColsInfo: [],
            tableDataInfo: [],
            tableDataTechnique: [],
            tableColsTechnique: [],
            tableDataProcedure: [],
            tableColsProcedure: [],
            tableDataCapacity: [],
            tableColsCapacity: [],
            searchHandle: [],
            billID: "",
            IsfunEdit: false,
            Isfunfail: false,
            SearchGroupInfo: {
                // 查询条件
                total: 0, // 总记录数
                pageSize: 100, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1595", // 表编号  根据Controller中对应的表编号 //更改
                InterID: "1595",
                jsWhere: "", // 自定义条件
                Download: "",
                IsFieldText: "0",
            },
            SearchGroup: {
                // 查询条件
                total: 0, // 总记录数
                pageSize: 100, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1594", // 表编号  根据Controller中对应的表编号
                InterID: "1594",
                jsWhere: "", // 自定义条件
                Download: "",
                YearMonth: "",
                OrganizeID: "",
                LineName: "",
                IsFieldText: "0",
                // Status: 0,
                //   BillState: "BillStateALL",
            },
            SearchTechnique: {
                // 查询条件
                total: 0, // 总记录数
                pageSize: 100, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1595", // 表编号  根据Controller中对应的表编号 //更改
                InterID: "1595",
                jsWhere: "", // 自定义条件
                Download: "",
                IsFieldText: "0",
            },
            SearchProcedure: {
                // 查询条件
                total: 0, // 总记录数
                pageSize: 100, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1630", // 表编号  根据Controller中对应的表编号 //更改
                InterID: "1630",
                jsWhere: "", // 自定义条件
                Download: "",
                WorkingDate: [],
                IsFieldText: "0",
                OrganizeID: "",
            },
            SearchCapacity: {
                // 查询条件
                total: 0, // 总记录数
                pageSize: 100, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1628", // 表编号  根据Controller中对应的表编号 //更改
                InterID: "1628",
                jsWhere: "", // 自定义条件
                IsFieldText: "0",
                Download: "",
            },
            SearchTechnology: {
                // 查询条件
                total: 0, // 总记录数
                pageSize: 100, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1631", // 表编号  根据Controller中对应的表编号 //更改
                InterID: "1631",
                IsFieldText: "0",
                jsWhere: "", // 自定义条件
                Download: "",
            },
            Search15: {
                // 查询条件
                total: 0, // 总记录数
                pageSize: 100, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1588", // 表编号  根据Controller中对应的表编号 //更改
                InterID: "1588",
                IsFieldText: "0",
                jsWhere: "", // 自定义条件
                Download: "",
            },

            cities: [
                {
                    value: "ALL",
                    label: "ALL",
                },
                {
                    value: "0",
                    label: "草稿",
                },
                {
                    value: "1",
                    label: "审核中",
                },
                {
                    value: "2",
                    label: "结案",
                },
                {
                    value: "3",
                    label: "作废",
                },
            ],
            BillStatecities: [
                {
                    value: "BillStateALL",
                    label: "ALL",
                },
                {
                    value: "0",
                    label: "未完成",
                },
                {
                    value: "2",
                    label: "已完成",
                },
            ],
            SearchDialog: false,
            DialogBtnMargin: 0,
            dialogVisible: false,
            valueID: "",
            selectDate: [],
            selectMiData: [],
        };
    },

    components: {
        //引入组件后注册组件
        cesTable,
        vGetToolBar,
        SearchForm,
        MianForm,
    },
    mounted() {
        this.ToolBarheight = parseInt(document.documentElement.clientHeight * 0.67);
        this.ToolBarheight2 = parseInt(
            document.documentElement.clientHeight * 0.72
        );
        this.getDataList();
        this.getDataListThree();

        //下表查询
        this.SearchGroupInfo = this.SearchTechnique;
        // this.tableColsInfo = this.tableColsTechnique;
    },

    methods: {
        selectMi(data) {
            this.selectMiData = data
        },
        selectMath(data) {
            this.selectDate = data
        },
        async toTop() {
            if (this.technologyID === null) {
                this.$message.warning("请选择工艺");
                return
            }
            this.selectDate.forEach(async (data, i) => {
                // let date = {
                //     ProcessGroupInfoID: '',
                //     ProcessGroupID: this.Id,
                //     ProcessID: data.ProcessID
                // }
                //查询更改
                this.SearchTechnique.ProcessGroupID = this.Id
                this.SearchTechnique.ProcessID = data.ProcessID
                let res = await getDataList({ data: JSON.stringify(this.SearchTechnique) })
                this.SearchTechnique.ProcessID = ''
                let date = res.data.Table[0] || { ProcessGroupInfoID: '' }

                date.ProcessGroupID = this.Id
                date.ProcessID = data.ProcessID

                let result = await UpdateForm({
                    IsPostBack: true,
                    InterID: this.SearchTechnique.InterID,
                    SavaDate: JSON.stringify(date),
                });

                if (i == this.selectDate.length - 1) {
                    if (result.code === 20000) {
                        this.$notify({
                            title: result.msg,
                            dangerouslyUseHTMLString: true,
                            message: "",
                            type: "success",
                        });

                        const res2 = await getDataList({
                            data: JSON.stringify(this.SearchTechnique),
                        });
                        this.SearchTechnique.total = res2.data.Table1[0].RecordCount;
                        this.tableDataTechnique = res2.data.Table;
                    } else {
                        this.$notify({
                            title: result.msg,
                            dangerouslyUseHTMLString: true,
                            message: "",
                            type: "error",
                        });
                    }
                }
            })

        },
        async searchTop() {
            const res = await getDataList({ data: JSON.stringify(this.SearchGroup) });
            this.SearchGroup.total = res.data.Table1[0].RecordCount;
            this.tableData = res.data.Table;
        },
        async searchDown() {
            const res = await getDataList({
                data: JSON.stringify(this.SearchGroupInfo),
            });
            this.SearchGroupInfo.total = res.data.Table1[0].RecordCount;
            if (this.SearchGroupInfo.InterID == 1595)
                this.tableDataTechnique = res.data.Table;
            if (this.SearchGroupInfo.InterID == 1630)
                this.tableDataProcedure = res.data.Table;
            if (this.SearchGroupInfo.InterID == 1628)
                this.tableDataCapacity = res.data.Table;
        },
        handrowclickTechnique({ row }) {
            this.valueID = row.ProcessGroupID;
        },
        selectMata(data) {
            this.selectData = data;
        },
        //配置工艺
        configure() {
            let flag = false;
            let result1;
            this.selectMiData.forEach(async (obj) => {
                let data = {
                    ProcessGroupMaterialID: obj.ProcessGroupMaterialID,
                    // MaterialID: obj.MaterialID,
                    // ProcessGroupID: this.valueID,
                    // Status: 1,
                };

                const result = await UpdateForm({
                    IsPostBack: false,
                    InterID: this.SearchTechnology.InterID,
                    SavaDate: JSON.stringify(data),
                });

                result.data1.Table[0].MaterialID = obj.MaterialID;
                result.data1.Table[0].ProcessGroupID = this.Id;
                result.data1.Table[0].Status = 1;
                result1 = await UpdateForm({
                    IsPostBack: true,
                    InterID: this.SearchTechnology.InterID,
                    SavaDate: JSON.stringify(result.data1.Table[0]),
                });
                // debugger
                if (result1.code === 20000) {
                    flag = true;
                }
            });
            setTimeout(async () => {
                if (flag) {
                    this.$notify({
                        title: result1.msg,
                        dangerouslyUseHTMLString: true,
                        message: "",
                        type: "success",
                    });
                    const res = await getDataList({ data: JSON.stringify(this.SearchProcedure) });
                    this.SearchProcedure.total = res.data.Table1[0].RecordCount;
                    this.tableDataProcedure = res.data.Table;
                } else {
                    this.$notify({
                        title: result1.msg,
                        dangerouslyUseHTMLString: true,
                        message: "",
                        type: "error",
                    });
                }
            }, 1500);
        },
        handleClick({ index }) {
            if (index == 0) {
                this.SearchGroupInfo = this.SearchTechnique;
                this.tableColsInfo = this.tableColsTechnique;
            }
            if (index == 1) {
                this.SearchGroupInfo = this.SearchProcedure;
                this.tableColsInfo = this.tableColsProcedure;
            }
            if (index == 2) {
                this.SearchGroupInfo = this.SearchCapacity;
                this.tableColsInfo = this.tableColsCapacity;
            }
        },
        async handleEditDown({ row }, num) {
            if (num === 2) {
                this.dialog2 = true;
                const result = await UpdateForm({
                    IsPostBack: false,
                    InterID: this.SearchProcedure.InterID,
                    SavaDate: JSON.stringify(row),
                });
                this.FormDataInfo = result.data1.Table[0];
                this.tableColsInfo = this.tableColsProcedure;
            }
            if (num === 3) {
                this.dialog2 = true;
                const result = await UpdateForm({
                    IsPostBack: false,
                    InterID: this.SearchCapacity.InterID,
                    SavaDate: JSON.stringify(row),
                });
                this.FormDataInfo = result.data1.Table[0];
                this.tableColsInfo = this.tableColsCapacity;
            }
        },
        refresh() {
            this.getDataList();
        },

        addTableDataInfo() {
            let data = {
                ProcessGroupInfoID: null,
                ProcessID: null,
                ProcessGroupID: this.technologyID,
                IsScheduling: null,
                PostProcessID: null,
                FixDay: null,
                AcquisitionTimes: null,
                OrganizeID: null,
                CreatedByName: null,
                ModifiedByName: null,
                CreatedOn: null,
                ModifyedOn: null,
            };
            this.FormDataInfo = data;
            this.dialog2 = true;
        },

        async addTableData() {
            let data = {
                ProcessGroupID: null,
                ProcessGroupName: null,
                OrganizeID: null,
                Status: null,
                CreatedBy: null,
                CreatedByName: null,
                ModifiedBy: null,
                ModifiedByName: null,
                CreatedOn: null,
                ModifyedOn: null,
                Remark1: null,
                Remark2: null,
                ByRegion: null,
                SchedulingSeq: null,
            };
            this.FormData = data;
            this.dialogVisible = true;
        },

        reform() {
            this.SearchGroup = {
                // 查询条件
                // total: 0, // 总记录数
                pageSize: 13, // 一页显示的记录数
                page: 1, // /当前页码
                RNO: "1626", // 表编号  根据Controller中对应的表编号 //更改
                InterID: "1626",
                jsWhere: "", // 自定义条件
                Download: "",
                //   Status: 0,
                //   BillState: "BillStateALL",
            };
            // this.Search.InterID = this.InterID;
            // this.Search.RNO = this.InterID;
            this.getDataList();
        },

        async getDataList() {
            //表头数据

            const res = await getDataList({ data: JSON.stringify(this.SearchGroup) });
            this.SearchGroup.total = res.data.Table1[0].RecordCount;
            this.tableData = res.data.Table;
            if (this.SearchGroup.IsFieldText !== "1") this.tableCols = res.data1;
            this.SearchGroup.IsFieldText = "1";

            const res15 = await getDataList({ data: JSON.stringify(this.Search15) });
            this.Search15.total = res15.data.Table1[0].RecordCount;
            this.tableData15 = res15.data.Table;
            if (this.Search15.IsFieldText !== "1") this.tableCols15 = res15.data1;
            this.Search15.IsFieldText = "1";

            this.SearchTechnique.jsWhere = `and  1 = 2`;
            const resCols = await getDataList({
                data: JSON.stringify(this.SearchTechnique),
            });
            if (this.SearchTechnique.IsFieldText !== "1") this.tableColsInfo = resCols.data1;
            if (this.SearchTechnique.IsFieldText !== "1") this.tableColsTechnique = resCols.data1;
            this.SearchTechnique.jsWhere = "";
            this.SearchTechnique.IsFieldText = "1";
        },

        async getDataListThree() {
            // const res1 = await getDataList({
            //     data: JSON.stringify(this.SearchTechnique),
            // });
            // this.SearchTechnique.IsFieldText = "1";
            // this.SearchTechnique.total = res1.data.Table1[0].RecordCount;
            // // this.tableDataTechnique = res1.data.Table;
            // this.tableColsTechnique = res1.data1;
            // this.tableColsInfo = res1.data1;

            const res2 = await getDataList({
                data: JSON.stringify(this.SearchProcedure),
            });
            this.SearchProcedure.IsFieldText = "1";
            this.SearchProcedure.total = res2.data.Table1[0].RecordCount;
            this.tableDataProcedure = res2.data.Table;
            this.tableColsProcedure = res2.data1;

            const res3 = await getDataList({
                data: JSON.stringify(this.SearchCapacity),
            });
            this.SearchCapacity.IsFieldText = "1";
            this.SearchCapacity.total = res3.data.Table1[0].RecordCount;
            this.tableDataCapacity = res3.data.Table;
            this.tableColsCapacity = res3.data1;
        },

        OpenFindForm() {
            // alert(JSON.stringify(this.tableCols))
            //打开搜索框
            this.SearchDialog = true;
            //计算外边距
            console.log(this.$refs.searchDialog.offsetHeight);
            this.DialogBtnMargin = this.$refs.searchDialog.offsetHeight - 40;
        },

        async handlexportData() {
            this.SearchGroup.Download = "1";
            const res = await getfunDownload({
                data: JSON.stringify(this.SearchGroup),
            });
            this.SearchGroup.Download = "0";
            funDownloadv1(res); //更改
        },

        handleIsfunEdit() {
            this.IsfunEdit = true;
        },
        handleIsfunfail() {
            this.Isfunfail = true;
        },
        async handeAdd() {
            // 新建

            const result = await UpdateForm({
                IsPostBack: false,
                InterID: 1594,
            });
            // debugger
            this.FormData = result.data1.Table[0];
            // this.dialogType = "edit";
            this.dialogVisible = true;
            // this.checkStrictly = true;

            // this.$nextTick(() => {
            //     const routes = this.generateRoutes(this.EditObj.routes);
            //     this.$refs.tree.setCheckedNodes(this.generateArr(routes));
            //     // set checked state of a node not affects its father and child nodes
            //     this.checkStrictly = false;
            // });
            // this.getDataList();

            // let routeUrl = this.$router.push({
            //   path: "/MesPieceWork/CompleteProcedureRoportForm",//更改
            //   query: { billID: "", IsPostBack: false },
            // });
            // window.open(routeUrl.path, "_top");
        },
        async handleEdit(scope) {
            // alert(scope.row)
            // 修改
            this.dialogVisible = true;
            const result = await UpdateForm({
                IsPostBack: false,
                InterID: this.SearchGroup.InterID,
                SavaDate: JSON.stringify(scope.row),
            });
            this.FormData = result.data1.Table[0];
            // alert(JSON.stringify(this.FormData))
            this.dialogType = "edit";
            this.checkStrictly = true;
            this.$nextTick(() => {
                const routes = this.generateRoutes(this.EditObj.routes);
                this.$refs.tree.setCheckedNodes(this.generateArr(routes));
                this.checkStrictly = false;
            });
            this.getDataList();
        },

        async handleEditInfo(scope) {
            this.index = scope.$index;
            // alert(this.index)
            // 修改
            this.dialog2 = true;
            const result = await UpdateForm({
                IsPostBack: false,
                InterID: this.SearchGroupInfo.InterID,
                SavaDate: JSON.stringify(scope.row),
            });
            this.FormDataInfo = result.data1.Table[0];
            this.dialogType = "edit";
            this.checkStrictly = true;
            this.$nextTick(() => {
                const routes = this.generateRoutes(this.EditObj.routes);
                this.$refs.tree.setCheckedNodes(this.generateArr(routes));
                // set checked state of a node not affects its father and child nodes
                this.checkStrictly = false;
            });
            // this.getDataList();
        },

        async handleSave() {
            // 修改
            const result = await UpdateForm({
                IsPostBack: true,
                InterID: '1594',
                SavaDate: JSON.stringify(this.FormData),
            });
            // alert(JSON.stringify(this.FormData))
            this.FormData = result.data1.Table[0];
            if (result.code === 20000) {
                this.$notify({
                    title: result.msg,
                    dangerouslyUseHTMLString: true,
                    message: "",
                    type: "success",
                });
                const reCode = await getDataList({
                    data: JSON.stringify(this.SearchGroup),
                });
                this.tableData = reCode.data.Table;
                // this.SearchGroup.total = reCode.data.Table1[0].RecordCount;
            } else {
                this.$notify({
                    title: result.msg,
                    dangerouslyUseHTMLString: true,
                    message: "",
                    type: "error",
                });
            }
            this.dialogVisible = false;
        },

        async handleSaveInfo() {
            // 修改
            const result = await UpdateForm({
                IsPostBack: true,
                InterID: this.SearchGroupInfo.InterID,
                SavaDate: JSON.stringify(this.FormDataInfo),
            });
            this.FormDataInfo = result.data1.Table[0];

            const resInfo = await getDataList({
                data: JSON.stringify(this.SearchGroupInfo),
            });
            this.tableDataProcedure = resInfo.data.Table;
            this.SearchGroupInfo.total = resInfo.data.Table1[0].RecordCount;

            if (result.code === 20000) {
                this.$notify({
                    title: result.msg,
                    dangerouslyUseHTMLString: true,
                    message: "",
                    type: "success",
                });

            } else {
                this.$notify({
                    title: result.msg,
                    dangerouslyUseHTMLString: true,
                    message: "",
                    type: "error",
                });
            }
            this.dialog2 = false;
            // alert(222)
        },

        async delData({ $index, row }) {
            this.$confirm("删除操作, 是否继续?", "提示", {
                confirmButtonText: "确认",
                cancelButtonText: "取消",
            })
                .then(async () => {
                    const result = await DeleteForm({
                        InterID: this.SearchGroup.InterID,
                        SavaDate: JSON.stringify(row),
                        IsPostBack: false,
                    });

                    const reCode = await getDataList({
                        data: JSON.stringify(this.SearchGroup),
                    });
                    this.tableData = reCode.data.Table;
                    this.SearchGroup.total = res2.data.Table1[0].RecordCount;

                    this.$message({
                        type: "success",
                        message: result.msg,
                    });
                })
                .catch((err) => {
                    console.error(err);
                });
        },

        delDataInfo({ $index, row }) {
            this.$confirm("删除操作, 是否继续?", "提示", {
                confirmButtonText: "确认",
                cancelButtonText: "取消",
            })
                .then(async () => {
                    const result = await DeleteForm({
                        InterID: this.SearchTechnique.InterID,
                        SavaDate: JSON.stringify(row),
                        IsPostBack: false,
                    });

                    const res2 = await getDataList({
                        data: JSON.stringify(this.SearchTechnique),
                    });
                    this.SearchTechnique.total = res2.data.Table1[0].RecordCount;
                    this.tableDataTechnique = res2.data.Table;

                    this.$message({
                        type: "success",
                        message: result.msg,
                    });
                })
                .catch((err) => {
                    console.error(err);
                });
        },

        async handrowclickTop({ row }) {
            this.Id = row.ProcessGroupID;
            if (this.activeName !== "first") return
            this.SearchTechnique.ProcessGroupID = row.ProcessGroupID;
            const resInfo = await getDataList({
                data: JSON.stringify(this.SearchTechnique),
            });
            this.tableDataTechnique = resInfo.data.Table;
            this.technologyID = row.ProcessGroupID;
            this.SearchTechnique.total = resInfo.data.Table1[0].RecordCount;
        },

        handleOpenClose() {
            this.dialogVisible = false;
            this.dialog2 = false;
        },
        handleclose() {
            if (this.billID != "") {
                this.$confirm("关单操作, 是否继续? 订单号：" + this.billID, "提示", {
                    confirmButtonText: "确认",
                    cancelButtonText: "取消",
                })
                    .then(async () => {
                        const result = await CloseForm({
                            billID: this.billID,
                            types: 1,
                            IsPostBack: false,
                        });
                        this.getDataList();
                        this.$message({
                            type: "success",
                            message: result.msg,
                        });
                    })
                    .catch((err) => {
                        console.error(err);
                    });
            } else {
                this.$notify({
                    title: "关单操作，请选择数据" + this.billID,
                    dangerouslyUseHTMLString: true,
                    message: "",
                    type: "error",
                });
            }
        },
    },
};
</script>

<style lang="scss" scoped>
.app-container {
    width: 100%;
    overflow: hidden;

    /deep/ .el-tabs__nav {
        float: right !important;
        margin-right: 8px;
    }

    .black {
        background-color: #000;
        border-radius: 50%;
        color: white;
        width: 16px;
        height: 16px;
        margin-top: 110px;
    }

    .EditObjs-table {
        margin-top: 30px;
    }

    .permission-tree {
        margin-bottom: 5px;
    }

    .maindiv {
        display: flex;
        flex-wrap: wrap;
        width: 100%;

        .ces-main {
            position: relative;
            flex: 1;
            width: 80vw;
            overflow: outo;
        }

        .midMain {
            padding-top: 12px;
            width: 80vw;
            flex: 1;
            position: relative;

            .botonRight {
                position: absolute;
                right: 2px;
                top: 23px;
            }

            .GetToolBar {
                position: absolute;
                right: 2px;
                top: 23px;
            }
        }
    }
}

.searchDialog ::v-deep .el-dialog__header {
    background: #409eff;
}

.searchDialog ::v-deep .el-dialog__title {
    color: #fff;
}

.searchDialog ::v-deep .el-dialog__headerbtn .el-dialog__close {
    color: #fff;
}
</style>